import {setServer} from "@/utils/axios";
import {chargeUrl} from "../../../url";
const chargeRequest = setServer(chargeUrl);
import {hwyUrl} from "../../../url";
const hwyRequest = setServer(hwyUrl);
import {deviceUrl} from "../../../url";
const request = setServer(deviceUrl);
import {hwUrl} from "../../../url";
const hwRequest = setServer(hwUrl);
import {toolUrl} from "../../../url";
const toolRequest =setServer(toolUrl);
import {eventUrl} from "../../../url";
const eventRequest =setServer(eventUrl);

// 查询充电桩设备
export function getCharge(query) {
  return chargeRequest({
    url: '/device/',
    method: 'get',
    params: query
  })
}

// 新增充电桩设备
export function addCharge(query) {
  return chargeRequest({
    url: '/device/',
    method: 'post',
    data: query
  })
}

// 修改充电桩设备
export function updateCharge(query) {
  return chargeRequest({
    url: '/device/',
    method: 'put',
    data: query
  })
}

// 删除充电桩
export function deleteCharge(id) {
  return chargeRequest({
    url: '/device/'+id,
    method: 'delete',
  })
}

// 同步充电桩设备数据
export function synchronizeCharge() {
  return chargeRequest({
    url: '/device/synchronizeData',
    method: 'get',
  })
}


// 查询小区充电桩
export function getChargeByBiotopeId(query) {
  return chargeRequest({
    url: '/device/listByBiotopeId',
    method: 'get',
    params: query
  })
}

// 根据设备id查询充电桩
export function getChargeByDeviceId(query) {
  return chargeRequest({
    url: '/device/listByDeviceId',
    method: 'get',
    params: query
  })
}

// 绑定充电桩
export function bindChargeDevice(query) {
  return chargeRequest({
    url: '/device/bindDevice',
    method: 'put',
    params: query
  })
}

// 充电桩绑定监控
export function chargeBindMonitor(query) {
  return chargeRequest({
    url: '/device/bindMonitorDevice',
    method: 'put',
    params: query
  })
}

// 查询小区设备列表
export function getMapDeviceList(query) {
  return request({
    url: '/device/list',
    method: 'get',
    params: query
  })
}

// 设置设备位置经纬度
export function setDeviceLocation(query) {
  return request({
    url: '/device/location',
    method: 'put',
    params: query
  })
}

// 查询小区设备交付情况
export function getScheduleDetail(query) {
  return request({
    url: '/device/',
    method: 'get',
    params: query
  })
}

// 查询视频地址
export function getLiveUrl(query) {
  return eventRequest({
    url: '/device/liveUrl',
    method: 'get',
    params: query
  })
}

// 查询大屏监控设备
export function getScreenMonitorDevice(query) {
  return eventRequest({
    url: '/device/getMonitorDevice',
    method: 'get',
    params: query
  })
}

// 查询视频渠道
export function getMonitorChannel(query) {
  return hwyRequest({
    url: '/device/nvrDevices',
    method: 'get',
    params: query
  })
}

// 查询视频设备
export function getVideoDevice(query) {
  return hwyRequest({
    url: '/device/',
    method: 'get',
    params: query
  })
}

// 查询视频设备详情
export function getVideoDeviceDetail(id) {
  return hwyRequest({
    url: '/device/'+id,
    method: 'get',
  })
}

// 新增视频设备
export function addVideoDevice(query) {
  return hwyRequest({
    url: '/device/',
    method: 'get',
    data: query
  })
}

// 修改视频设备
export function updateVideoDevice(query) {
  return hwyRequest({
    url: '/device/',
    method: 'get',
    data: query
  })
}

// 删除视频设备
export function deleteVideoDevice(id) {
  return hwyRequest({
    url: '/device/'+id,
    method: 'delete',
  })
}

// 绑定设备
export function bindVideoDevice(query) {
  return hwyRequest({
    url: '/device/bind/',
    method: 'put',
    params: query
  })
}


// 新增好望云设备
export function addHwyDevice(query) {
  return hwyRequest({
    url: '/device/',
    method: 'post',
    data: query
  })
}

// 修改好望云设备
export function updateHwyDevice(query) {
  return hwyRequest({
    url: '/device/',
    method: 'put',
    data: query
  })
}

// 删除好望云设备
export function deleteHwyDevice(query) {
  return hwyRequest({
    url: '/device/deleteDevice',
    method: 'delete',
    params: query
  })
}

// 重新同步好望云设备
export function reSynHwyDevice() {
  return hwyRequest({
    url: '/device/reSyncAllOrgDevice',
    method: 'get',
  })
}

// 好望云设备服务设置
export function setHwyServer(query) {
  return hwyRequest({
    url: '/device/enableManager',
    method: 'put',
    params: query
  })
}


// 获取华为门禁
export function getHuaweiDevice(query) {
  return hwRequest({
    url: '/api/device/list/',
    method: 'get',
    params: query
  })
}

// 重启设备华为设备
export function rebootHuaweiDevice(query) {
  return hwRequest({
    url: '/api/device/reboot',
    method: 'put',
    params: query
  })
}

// 华为设备登录
export function loginHuaweiDevice(query) {
  return hwRequest({
    url: '/api/device/login',
    method: 'get',
    params: query
  })
}

// 华为设备退出
export function logoutHuaweiDevice(query) {
  return hwRequest({
    url: '/api/device/logout',
    method: 'get',
    params: query
  })
}

// 检查华为设备在线状况
export function checkHuaweiOnline(query) {
  return hwRequest({
    url: '/api/device/checkOnline',
    method: 'get',
    params: query
  })
}

// 检测设备的在线缓存中是否存在改sn
export function checkHuaweiOnLineSet(query) {
  return hwRequest({
    url: '/api/device/checkOnLineSet',
    method: 'get',
    params: query
  })
}

// 生成序列号
export function createHuaweiNo() {
  return hwRequest({
    url: '/api/device/createNo',
    method: 'get',
  })
}

export function deleteHuaweiDevice(id) {
  return hwRequest({
    url: '/api/device/'+id,
    method: 'delete',
  })
}

export function getHuaweiDetail(sn) {
  return hwRequest({
    url: '/api/device/'+sn,
    method: 'get',
  })
}

// 查询踩点工具设备
export function getAllToolDevice() {
  return toolRequest({
    url: '/device/all-list',
    method: 'get'
  })
}

// 查询踩点工具设备
export function getToolDevice(query) {
  return toolRequest({
    url: '/device/list',
    method: 'get',
    params:query
  })
}

// 查询踩点工具设备详情
export function getToolDeviceDetail(query) {
  return toolRequest({
    url: '/device/detail',
    method: 'get',
    params:query
  })
}

// 导出
export function exportToolDevice(data,type){
  return toolRequest({
    url:'/muster/download',
    method: 'post',
    params: data,
    responseType:type
  })
}

// 修改踩点工具设备
export function updateToolDevice(query) {
  return toolRequest({
    url: '/device/',
    method: 'put',
    data:query
  })
}

// 查询踩点工具设备导出TXT数据
export function getToolListExportDeviceTxtData(query) {
  return toolRequest({
    url: '/device/export-txtdata',
    method: 'get',
    params:query
  })
}

// 查询踩点工具设备导出csv数据
export function getToolListExportDeviceCsvData(query) {
  return toolRequest({
    url: '/device/export-csvdata',
    method: 'get',
    params:query
  })
}

